#include "array/array.h"

#include <iostream>

void reverseArray(int arr[], const int start, const int end)
{
    if (end - start <= 0)
        return;

    const int temp = arr[start];

    reverseArray(arr, start + 1, end);

    for (int i = start; i <= end; i++)
    {
        arr[i - 1] = arr[i];
    }

    arr[end] = temp;
}

void testReverseArray()
{
    const int n1 = 5;
    const int n2 = 4;
    int arr1[n1] = {1, 2, 3, 4, 5};
    int arr2[n2] = {1, 2, 3, 4};

    reverseArray(arr1, 0, n1 - 1);
    for (int i = 0; i < n1; i++)
    {
        std::cout << arr1[i] << " ";
    }
    std::cout << std::endl;

    reverseArray(arr2, 0, n2 - 1);

    for (int i = 0; i < n2; i++)
    {
        std::cout << arr2[i] << " ";
    }
    std::cout << std::endl;
}
